#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<assert.h>


char* my_strstr(const char* str1, const char* str2)
{
	assert(str1 && str2);
	char* cp = (char*)str1;
	char* s1, *s2;
	if (!*str2)
	{
		return (char*)str1;
	}

	while (*cp)
	{
		s1 = cp;
		s2 = (char*)str2;
		while (*s2 && (*s1 == *s2))
		{
			s1++;
			s2++;
		}
		if (*s2 == '\0')
		{
			return cp;
		}
		cp++;
	}

	return NULL;
}

int main()
{
	char arr1[20] = "hhhhaaab";
	char* arr2 = "hhaa";
	printf("%s\n", my_strstr(arr1, arr2));
	return 0;
}